/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modele;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author michaelrepiso
 */
public class Dico {
    // Declaratin variables

    private String CallPutFlag;
    private Double S;
    private Double X;
    private Double T;
    private Double r;
    private Double b;
    private Double v;
    private Integer nSteps;
    private Integer nSimulations;
    private ArrayList<String> listCallPutFlag;
    private ArrayList<Double> listS;
    private ArrayList<Double> listX;
    private ArrayList<Double> listT;
    private ArrayList<Double> listr;
    private ArrayList<Double> listb;
    private ArrayList<Double> listv;
    private ArrayList<Integer> listnSteps;
    private ArrayList<Integer> listnSimulations;
    
    private double dt;
    private double Drift;
    private double vSqrdt;
    private int z;

    //Constructor
    public Dico() {
        this.CallPutFlag = "c";
        this.S = 40.0;
        this.X = 50.0;
        this.T = 0.5;
        this.r = 0.06;
        this.b = 0.10;
        this.v = 0.45;
        this.nSteps = 168;
        this.nSimulations = 100000;
        this.listCallPutFlag = new ArrayList<>();
        this.listS = new ArrayList<>();
        this.listX = new ArrayList<>();
        this.listT = new ArrayList<>();
        this.listr = new ArrayList<>();
        this.listb = new ArrayList<>();
        this.listv = new ArrayList<>();
        this.listnSteps = new ArrayList<>();
        this.listnSimulations = new ArrayList<>();
        
        this.dt = 0;
        this.Drift = 0;
        this.vSqrdt = 0;
        this.z = 0;
    }

    // Methods
    public void loadData(String filename) throws FileNotFoundException {
        Scanner sc;
        String donnee;
        int i = 0;
        int countLine = 0;

        sc = new Scanner(new File(filename));

        while (sc.hasNextLine()) {
            countLine++;
            i = 1;
            donnee = sc.nextLine();
            String[] chaine = donnee.split(";");

            for (String elt : chaine) {
                if (!elt.equals(chaine[0])) {
                    if (countLine == 1) {
                        this.listCallPutFlag.add(elt);
                    }
                    if (countLine == 2) {
                        this.listS.add(Double.parseDouble(elt));
                    }
                    if (countLine == 3) {
                        this.listX.add(Double.parseDouble(elt));
                    }
                    if (countLine == 4) {
                        this.listT.add(Double.parseDouble(elt));
                    }
                    if (countLine == 5) {
                        this.listr.add(Double.parseDouble(elt));
                    }
                    if (countLine == 6) {
                        this.listb.add(Double.parseDouble(elt));
                    }
                    if (countLine == 7) {
                        this.listv.add(Double.parseDouble(elt));
                    }
                    if (countLine == 8) {
                        this.listnSteps.add(Integer.parseInt(elt));
                    }
                    if (countLine == 9) {
                        this.listnSimulations.add(Integer.parseInt(elt));
                    }
                }


            }

        }
        sc.close();
    }

    @Override
    public String toString() {
        return listCallPutFlag + " " + listS + " " + listX + " " + listT + " " + listr + " " + listb + " "
                + listv + " " + listnSteps + " " + listnSimulations;

    }

    /**
     * @return the CallPutFlag
     */
    public String getCallPutFlag() {
        return CallPutFlag;
    }

    /**
     * @param CallPutFlag the CallPutFlag to set
     */
    public void setCallPutFlag(String CallPutFlag) {
        this.CallPutFlag = CallPutFlag;
    }

    /**
     * @return the S
     */
    public Double getS() {
        return S;
    }

    /**
     * @param S the S to set
     */
    public void setS(Double S) {
        this.S = S;
    }

    /**
     * @return the X
     */
    public Double getX() {
        return X;
    }

    /**
     * @param X the X to set
     */
    public void setX(Double X) {
        this.X = X;
    }

    /**
     * @return the T
     */
    public Double getT() {
        return T;
    }

    /**
     * @param T the T to set
     */
    public void setT(Double T) {
        this.T = T;
    }

    /**
     * @return the r
     */
    public Double getR() {
        return r;
    }

    /**
     * @param r the r to set
     */
    public void setR(Double r) {
        this.r = r;
    }

    /**
     * @return the b
     */
    public Double getB() {
        return b;
    }

    /**
     * @param b the b to set
     */
    public void setB(Double b) {
        this.b = b;
    }

    /**
     * @return the v
     */
    public Double getV() {
        return v;
    }

    /**
     * @param v the v to set
     */
    public void setV(Double v) {
        this.v = v;
    }

    /**
     * @return the nSteps
     */
    public Integer getnSteps() {
        return nSteps;
    }

    /**
     * @param nSteps the nSteps to set
     */
    public void setnSteps(Integer nSteps) {
        this.nSteps = nSteps;
    }

    /**
     * @return the nSimulations
     */
    public Integer getnSimulations() {
        return nSimulations;
    }

    /**
     * @param nSimulations the nSimulations to set
     */
    public void setnSimulations(Integer nSimulations) {
        this.nSimulations = nSimulations;
    }

    /**
     * @return the listCallPutFlag
     */
    public ArrayList<String> getListCallPutFlag() {
        return listCallPutFlag;
    }

    /**
     * @param listCallPutFlag the listCallPutFlag to set
     */
    public void setListCallPutFlag(ArrayList<String> listCallPutFlag) {
        this.listCallPutFlag = listCallPutFlag;
    }

    /**
     * @return the listS
     */
    public ArrayList<Double> getListS() {
        return listS;
    }

    /**
     * @param listS the listS to set
     */
    public void setListS(ArrayList<Double> listS) {
        this.listS = listS;
    }

    /**
     * @return the listX
     */
    public ArrayList<Double> getListX() {
        return listX;
    }

    /**
     * @param listX the listX to set
     */
    public void setListX(ArrayList<Double> listX) {
        this.listX = listX;
    }

    /**
     * @return the listT
     */
    public ArrayList<Double> getListT() {
        return listT;
    }

    /**
     * @param listT the listT to set
     */
    public void setListT(ArrayList<Double> listT) {
        this.listT = listT;
    }

    /**
     * @return the listr
     */
    public ArrayList<Double> getListr() {
        return listr;
    }

    /**
     * @param listr the listr to set
     */
    public void setListr(ArrayList<Double> listr) {
        this.listr = listr;
    }

    /**
     * @return the listb
     */
    public ArrayList<Double> getListb() {
        return listb;
    }

    /**
     * @param listb the listb to set
     */
    public void setListb(ArrayList<Double> listb) {
        this.listb = listb;
    }

    /**
     * @return the listv
     */
    public ArrayList<Double> getListv() {
        return listv;
    }

    /**
     * @param listv the listv to set
     */
    public void setListv(ArrayList<Double> listv) {
        this.listv = listv;
    }

    /**
     * @return the listnSteps
     */
    public ArrayList<Integer> getListnSteps() {
        return listnSteps;
    }

    /**
     * @param listnSteps the listnSteps to set
     */
    public void setListnSteps(ArrayList<Integer> listnSteps) {
        this.listnSteps = listnSteps;
    }

    /**
     * @return the listnSimulations
     */
    public ArrayList<Integer> getListnSimulations() {
        return listnSimulations;
    }

    /**
     * @param listnSimulations the listnSimulations to set
     */
    public void setListnSimulations(ArrayList<Integer> listnSimulations) {
        this.listnSimulations = listnSimulations;
    }

    /**
     * @return the dt
     */
    public double getDt() {
        return dt;
    }

    /**
     * @param dt the dt to set
     */
    public void setDt(double dt) {
        this.dt = dt;
    }

    /**
     * @return the Drift
     */
    public double getDrift() {
        return Drift;
    }

    /**
     * @param Drift the Drift to set
     */
    public void setDrift(double Drift) {
        this.Drift = Drift;
    }

    /**
     * @return the vSqrdt
     */
    public double getvSqrdt() {
        return vSqrdt;
    }

    /**
     * @param vSqrdt the vSqrdt to set
     */
    public void setvSqrdt(double vSqrdt) {
        this.vSqrdt = vSqrdt;
    }

    /**
     * @return the z
     */
    public int getZ() {
        return z;
    }

    /**
     * @param z the z to set
     */
    public void setZ(int z) {
        this.z = z;
    }
}
